package com.crm.common.util;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Iterator;

/**
 * @Author:chaifuyou
 * @Date: 2021/5/22 13:45
 */
public class test {

    public static void main(String[] args) throws IOException {
        /*String filePath = "./test-utf8.TXT";
        String tt=new String();
        BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "UTF8"));
        String str;
        while ((str = in.readLine()) != null) {
            tt+=str;
        }
        test1(tt);

        System.out.println("*************************");
        filePath = "./test1.txt";
        BufferedReader in2 = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "UTF8"));
        String str2;
        String tt2=new String();
        while ((str2 = in2.readLine()) != null) {
            tt2+=str2;
        }*/
        String str2 = "我是你爸爸，是你爸爸，我是你爷爷,公司，吃饭吗，吃鱼香肉丝,回家吃饭吗宝贝,";
        System.out.println(str2.substring(0,str2.length()-1));
        test1(str2);

    }

    public static void test1(String content){
        KeyWordComputer key=new KeyWordComputer(10);
        Iterator it = key.computeArticleTfidf(content).iterator() ;
        while(it.hasNext()) {
            Keyword key2=(Keyword)it.next();
            System.out.println(key2/*.toString()+key2.getScore()*/);
        }
    }

}
